package com.bgs.engineering.util;

import org.springframework.cglib.beans.BeanCopier;

/**
 * @auther zcy
 * @data 2020/6/3 13:07
 */
public class BeanUtils {

    public static void copy(Object source, Object target) {
        if (ObjectUtils.isNotEmpty(source)) {
            BeanCopier copier = BeanCopier.create(source.getClass(), target.getClass(), false);
            copier.copy(source, target, null);
        }
    }

     /**
   * 格式转换
   * 项目状态  1待立项  2已立项  3 投标中  4 已落标 5 已中标    6待施工  7施工中   8已竣工   9已关闭
   *
   * @return
   */
  public static String getProjectStatus(String t) {
    String projectStatus = "";
    switch (t) {
      case "1":
        projectStatus = "待立项";
        break;
      case "2":
        projectStatus = "已立项";
        break;
      case "3":
        projectStatus = "投标中";
        break;
      case "4":
        projectStatus = "已落标";
        break;
      case "5":
        projectStatus = "已中标";
        break;
      case "6":
        projectStatus = "待施工";
        break;
      case "7":
        projectStatus = "施工中";
        break;
      case "8":
        projectStatus = "已竣工";
        break;
      case "9":
        projectStatus = "已关闭";
        break;
      default:
        projectStatus = "未知";
        break;
    }
    return projectStatus;
  }

  /**
   * 格式转换
   * 审核状态 0待审核 1已提交 2已通过 3未通过
   *
   * @param t
   * @return
   */
  public static String getState(String t) {
    String state = "";
    switch (t) {
      case "0":
        state = "待审核";
        break;
      case "1":
        state = "已提交";
        break;
      case "2":
        state = "已通过";
        break;
      case "3":
        state = "未通过";
        break;
      default:
        state = "未知";
        break;
    }
    return state;
  }
}
